/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controllers.utils;

import Model.ProductBasket;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 *
 * @author Anthares
 */
public class SessionStateListener implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        HttpSession session;
        synchronized(session = se.getSession()){
            session.setAttribute("basket", new ProductBasket());
            session.setAttribute("user", null);
            session.setMaxInactiveInterval(3600);
            session.setAttribute("lang", "en_US");
        }
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
    }
}
